//
//  LXAlertView.m
//  bgms_d
//
//  Created by lachesis-zhu on 2019/2/26.
//  Copyright © 2019 lachesis-zhu. All rights reserved.
//

#import "LXSheetView.h"

@implementation LXSheetView

- (void)awakeFromNib {
    [super awakeFromNib];

    UITapGestureRecognizer *gesture1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDown:)];
    gesture1.numberOfTapsRequired = 1;
    gesture1.numberOfTouchesRequired = 1;
    [self.borderView1 addGestureRecognizer:gesture1];
    
    UITapGestureRecognizer *gesture2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDown:)];
    gesture2.numberOfTapsRequired = 1;
    gesture2.numberOfTouchesRequired = 1;
    [self.borderView2 addGestureRecognizer:gesture2];
    
    self.borderView1.tag = 1;
    self.borderView2.tag = 2;
    [self.borderView1 drawAroundViewWithLocation:DrawTop color:kAppLinesColor insets:UIEdgeInsetsMake(0, 0, -0.5, 0)];
    [self.borderView2 drawAroundViewWithLocation:DrawTop color:kAppLinesColor insets:UIEdgeInsetsMake(0, 0, -0.5, 0)];
    self.detailLabel1.numberOfLines = 2;
    self.detailLabel1.lineBreakMode = NSLineBreakByTruncatingTail;
    self.detailLabel2.numberOfLines = 2;
    self.detailLabel2.lineBreakMode = NSLineBreakByTruncatingTail;
}

- (void)tapDown:(UIGestureRecognizer *)gesture {
    UIView *view = gesture.view;
    if (self.delegate && [self.delegate respondsToSelector:@selector(sheetView:selectIndex:)]) {
        [self.delegate sheetView:self selectIndex:view.tag];
    }
}

- (IBAction)cancelDown:(id)sender {
    [self removeFromSuperview];
}
@end
